//
//  CCMacroFile.h
//  CarCircle
//
//  Created by chenfangkun on 2019/1/11.
//  Copyright © 2019 chenfangkun. All rights reserved.
//

#ifndef CCMacroFile_h
#define CCMacroFile_h

/// 1.大小
#define KSCREENHEIGHT [[UIScreen mainScreen] bounds].size.height
#define KSCREENWIDTH [[UIScreen mainScreen] bounds].size.width
#define KPWValueH(value) value * [PWFactory pw_ratio]

/// 2.颜色
#define KRGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
/// 16进制
#define kYJHexColor(colorValue) [UIColor colorWithRed:((float)((colorValue & 0xFF0000) >> 16))/255.0 green:((float)((colorValue & 0xFF00) >> 8))/255.0 blue:((float)(colorValue & 0xFF))/255.0 alpha:1.0f]
/// 背景颜色
#define KBackgroundColor KRGBACOLOR(243,243,243,1.0)
/// 下划线
#define KRGBLine KRGBACOLOR(222,223,224,1.0)
/// 按钮主题颜色
#define KRGBButton KRGBACOLOR(57, 130, 247, 1.0)

/// 3.判断手机型号
#define kIsiPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhone6_OR_7 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhone6Plus_OR_7Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhoneXPlus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhoneXS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define kIsiPhoneXS_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)
/// 4.定义UIImage对象 设置字体大小
#define KPWImage(img_name) [UIImage imageNamed:img_name]
#define KPWFont(font_name) [UIFont systemFontOfSize:font_name * [PWFactory pw_ratio]]
/// 5.屏蔽log
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...)
#endif
/// 6.登录唯一标示
#define Ktoken @"token"//用户唯一标识
// 是否登录Bool值
#define Kautologin @"autologin"
#define KNameUrl @"nameUrl" // 头像
#define KName @"name" // 名称

/// 7. 强、弱引用
#define KPWWeakSelf(type) __weak typeof(type) weak##type = type
#define KPWStrongSelf(type) __strong typeof(type) strong##type = type

/// 8.常用对象
#define KPWUserDefaults [NSUserDefaults standardUserDefaults]
/// delegate
#define kYJApplication [UIApplication sharedApplication]
#define KPWAppDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)

/// 9.适配iPhonex
#pragma mark - iPhoneX适配
/** 设备是否为iPhone X*/
#define isIphoneX (KSCREENHEIGHT == 812.0 || KSCREENHEIGHT == 896.0 ? YES : NO)
/** 导航条高度*/
#define kNavgationHeight (isIphoneX ? 88 : 64)
/// tableview高度
#define KTableViewH (isIphoneX ? -48 :-20)
/// 自定义导航条iPhoneX加24高度
#define KCustomNavH (isIphoneX ? 24 : 0)
/** 底部边界值  iPhone X需求使用*/
#define kSafeAreaBottomHeight (isIphoneX ? 34 : 0)
/** 底部边界值  iPhone X、R、Max需求使用*/
#define k_Height_TabBar (isIphoneX ? 83.0 : 49.0)


/// 返回键
#define KLeft @"com_back"
/// 提示出错
#define KErrors @"请检查您当前的网络状态！"
/// 占位图
#define KPlaceholderFigure @""
/// 没数据显示占位图
#define KNoData @"noData"


#endif /* CCMacroFile_h */
